﻿/* Copyright (c) 2007 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Collections;

namespace Google.Apps.Reporting
{

    /// <summary>
    /// abstract
    /// </summary>
    public abstract class Report
    {

    }

    /// <summary>
    /// The accounts report contains a list of all of the hosted accounts that exist in your domain on a particular day. 
    /// The report includes both active accounts and suspended accounts. The status column will indicate whether each account 
    /// is active or suspended.
    /// </summary>
    public class AccountsReport : Google.Apps.Reporting.Report, IList<Google.Apps.Reporting.AccountsReportRecord>
    {

        //list used to store data from report
        private List<AccountsReportRecord> _reportList = new List<AccountsReportRecord>();

        #region instantiation

        #endregion

        #region sort helper

        /// <summary>
        /// sort helper enum
        /// </summary>
        public enum SortBy
        {
            date, account_id, account_name, status, quota_in_mb, usage_in_bytes,
            primary_account_id, primary_account_name, creation_date, last_login_date,
            last_web_mail_date, surname, given_name, service_tier, channel, suspension_reason,
            last_pop_date, creation_time, last_login_time, last_web_mail_time, last_pop_time
        }

        /// <summary>
        /// sort report based on values of fields within the ReportRecords.
        /// </summary>
        /// <param name="sortOnField">enum of field to sort on</param>
        public void Sort(SortBy sortOnField)
        {
            switch (sortOnField)
            {
                case SortBy.date:
                    _reportList.Sort(AccountsReportRecord.ReportDateSorter);
                    break;
                case SortBy.account_id:
                    _reportList.Sort(AccountsReportRecord.AccountIdSorter);
                    break;
                case SortBy.account_name:
                    _reportList.Sort(AccountsReportRecord.AccountNameSorter);
                    break;
                case SortBy.status:
                    _reportList.Sort(AccountsReportRecord.AccountStatusSorter);
                    break;
                case SortBy.quota_in_mb:
                    _reportList.Sort(AccountsReportRecord.AccountQuotaInMBSorter);
                    break;
                case SortBy.usage_in_bytes:
                    _reportList.Sort(AccountsReportRecord.AccountUsageInBytesSorter);
                    break;
                case SortBy.primary_account_id:
                    _reportList.Sort(AccountsReportRecord.AccountPrimaryIdSorter);
                    break;
                case SortBy.primary_account_name:
                    _reportList.Sort(AccountsReportRecord.AccountPrimaryNameSorter);
                    break;
                case SortBy.creation_date:
                    _reportList.Sort(AccountsReportRecord.AccountCreationDateSorter);
                    break;
                case SortBy.last_login_date:
                    _reportList.Sort(AccountsReportRecord.AccountLastLoginDateSorter);
                    break;
                case SortBy.last_web_mail_date:
                    _reportList.Sort(AccountsReportRecord.AccountLastWebMailDateSorter);
                    break;
                case SortBy.surname:
                    _reportList.Sort(AccountsReportRecord.AccountSurnameSorter);
                    break;
                case SortBy.given_name:
                    _reportList.Sort(AccountsReportRecord.AccountGivenNameSorter);
                    break;
                case SortBy.service_tier:
                    _reportList.Sort(AccountsReportRecord.AccountServiceTierSorter);
                    break;
                case SortBy.channel:
                    _reportList.Sort(AccountsReportRecord.AccountChannelSorter);
                    break;
                case SortBy.suspension_reason:
                    _reportList.Sort(AccountsReportRecord.AccountSuspensionReasonSorter);
                    break;
                case SortBy.last_pop_date:
                    _reportList.Sort(AccountsReportRecord.AccountLastPopDateSorter);
                    break;
                case SortBy.creation_time:
                    _reportList.Sort(AccountsReportRecord.AccountCreationTimeSorter);
                    break;
                case SortBy.last_login_time:
                    _reportList.Sort(AccountsReportRecord.AccountLastLoginTimeSorter);
                    break;
                case SortBy.last_web_mail_time:
                    _reportList.Sort(AccountsReportRecord.AccountLastWebMailTimeSorter);
                    break;
                case SortBy.last_pop_time:
                    _reportList.Sort(AccountsReportRecord.AccountLastPopTimeSorter);
                    break;
                default:
                    throw new NotSupportedException("default case for sort by enum reached, should not occur");
            }
        }
        #endregion

        #region iList<T>
        public int IndexOf(AccountsReportRecord item)
        {
            return _reportList.IndexOf(item);
        }

        public void Insert(int index, AccountsReportRecord item)
        {
            _reportList.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            _reportList.RemoveAt(index);
        }

        public AccountsReportRecord this[int index]
        {
            get
            {
                return _reportList[index];
            }
            set
            {
                _reportList[index] = value;
            }
        }

        public void Add(AccountsReportRecord item)
        {
            _reportList.Add(item);
        }

        public void Clear()
        {
            _reportList.Clear();
        }

        public bool Contains(AccountsReportRecord item)
        {
            return _reportList.Contains<AccountsReportRecord>(item);
        }

        public void CopyTo(AccountsReportRecord[] array, int arrayIndex)
        {
            _reportList.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _reportList.Count; }
        }

        /// <summary>
        /// returns false
        /// </summary>
        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(AccountsReportRecord item)
        {
            return _reportList.Remove(item);
        }

        public IEnumerator<AccountsReportRecord> GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }
        #endregion
    }

    /// <summary>
    /// The activity report identifies the total number of accounts in your domain as well as the number of active and idle 
    /// accounts over several different time periods. In this report, activity encompasses user interaction with his email, 
    /// such as reading or sending email. The activity statistics includes web mail as well as POP activity.
    /// </summary>
    public class ActivityReport : Google.Apps.Reporting.Report, IList<ActivityReportRecord>
    {
        //list used to store data from report
        private List<ActivityReportRecord> _reportList = new List<ActivityReportRecord>();

        #region instantiation
        #endregion

        #region sort helper

        /// <summary>
        /// sort helper enum
        /// </summary>
        public enum SortBy
        {
            date, num_accounts, count_1_day_actives, count_7_day_actives, count_14_day_actives,
            count_30_day_actives, count_30_day_idle, count_60_day_idle, count_90_day_idle
        }

        /// <summary>
        /// sort report based on values of fields within the ReportRecords.
        /// </summary>
        /// <param name="sortOnField">enum of field to sort on</param>
        public void Sort(SortBy sortOnField)
        {
            switch (sortOnField)
            {
                case SortBy.date:
                    _reportList.Sort(ActivityReportRecord.ReportDateSorter);
                    break;
                case SortBy.num_accounts:
                    _reportList.Sort(ActivityReportRecord.ActivityNumAccountsSorter);
                    break;
                case SortBy.count_1_day_actives:
                    _reportList.Sort(ActivityReportRecord.Activity1DayActivesSorter);
                    break;
                case SortBy.count_7_day_actives:
                    _reportList.Sort(ActivityReportRecord.Activity7DayActivesSorter);
                    break;
                case SortBy.count_14_day_actives:
                    _reportList.Sort(ActivityReportRecord.Activity14DayActivesSorter);
                    break;
                case SortBy.count_30_day_actives:
                    _reportList.Sort(ActivityReportRecord.Activity30DayActivesSorter);
                    break;
                case SortBy.count_30_day_idle:
                    _reportList.Sort(ActivityReportRecord.Activity30DayIdleSorter);
                    break;
                case SortBy.count_60_day_idle:
                    _reportList.Sort(ActivityReportRecord.Activity60DayIdleSorter);
                    break;
                case SortBy.count_90_day_idle:
                    _reportList.Sort(ActivityReportRecord.Activity90DayIdleSorter);
                    break;
                default:
                    throw new NotSupportedException("default case for sort by enum reached, should not occur");
            }
        }
        #endregion


        #region iList<T>
        public int IndexOf(ActivityReportRecord item)
        {
            return _reportList.IndexOf(item);
        }

        public void Insert(int index, ActivityReportRecord item)
        {
            _reportList.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            _reportList.RemoveAt(index);
        }

        public ActivityReportRecord this[int index]
        {
            get
            {
                return _reportList[index];
            }
            set
            {
                _reportList[index] = value;
            }
        }

        public void Add(ActivityReportRecord item)
        {
            _reportList.Add(item);
        }

        public void Clear()
        {
            _reportList.Clear();
        }

        public bool Contains(ActivityReportRecord item)
        {
            return _reportList.Contains<ActivityReportRecord>(item);
        }

        public void CopyTo(ActivityReportRecord[] array, int arrayIndex)
        {
            _reportList.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _reportList.Count; }
        }

        /// <summary>
        /// returns false
        /// </summary>
        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(ActivityReportRecord item)
        {
            return _reportList.Remove(item);
        }

        public IEnumerator<ActivityReportRecord> GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }
        #endregion
    }

    /// <summary>
    /// The disk_space report shows the amount of disk space occupied by users' mailboxes. The report identifies the total number 
    /// of accounts in your domain as well as the number of accounts that fall into several different size groupings. Mailboxes 
    /// that occupy less than 1GB of disk space are grouped in increments of 100MB, and mailboxes that occupy between 1GB and 
    /// 10GB of disk space are grouped in increments of 500MB.
    /// </summary>
    public class DiskSpaceReport : Google.Apps.Reporting.Report, IList<DiskSpaceReportRecord>
    {
        //list used to store data from report
        private List<DiskSpaceReportRecord> _reportList = new List<DiskSpaceReportRecord>();

        #region instantiation
        #endregion

        #region sort helper

        /// <summary>
        /// sort helper enum
        /// </summary>
        public enum SortBy
        {
            date, num_accounts, usage_in_bytes, avg_usage_in_mb, quota_in_mb, avg_quota_in_mb, size_0_1gb, size_0_2gb, size_0_3gb, size_0_4gb, size_0_5gb, size_0_6gb,
            size_0_7gb, size_0_8gb, size_0_9gb, size_1_0gb, size_1_5gb, size_2_0gb, size_2_5gb, size_3_0gb, size_3_5gb, size_4_0gb, size_4_5gb, size_5_0gb, size_5_5gb,
            size_6_0gb, size_6_5gb, size_7_0gb, size_7_5gb, size_8_0gb, size_8_5gb, size_9_0gb, size_9_5gb, size_10_0gb
        }

        /// <summary>
        /// sort report based on values of fields within the ReportRecords.
        /// </summary>
        /// <param name="sortOnField">enum of field to sort on</param>
        public void Sort(SortBy sortOnField)
        {
            switch (sortOnField)
            {
                case SortBy.date:
                    _reportList.Sort(DiskSpaceReportRecord.ReportDateSorter);
                    break;
                case SortBy.num_accounts:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceNumAccountsSorter);
                    break;
                case SortBy.usage_in_bytes:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceUsageInBytesSorter);
                    break;
                case SortBy.avg_usage_in_mb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceAvgUsageInMBSorter);
                    break;
                case SortBy.quota_in_mb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceQuotaInMBSorter);
                    break;
                case SortBy.avg_quota_in_mb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceAvgQuotaInMBSorter);
                    break;
                case SortBy.size_0_1gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_1Sorter);
                    break;
                case SortBy.size_0_2gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_2Sorter);
                    break;
                case SortBy.size_0_3gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_3Sorter);
                    break;
                case SortBy.size_0_4gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_4Sorter);
                    break;
                case SortBy.size_0_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_5Sorter);
                    break;
                case SortBy.size_0_6gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_6Sorter);
                    break;
                case SortBy.size_0_7gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_7Sorter);
                    break;
                case SortBy.size_0_8gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_8Sorter);
                    break;
                case SortBy.size_0_9gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize0_9Sorter);
                    break;
                case SortBy.size_1_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize1_0Sorter);
                    break;
                case SortBy.size_1_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize1_5Sorter);
                    break;
                case SortBy.size_2_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize2_0Sorter);
                    break;
                case SortBy.size_2_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize2_5Sorter);
                    break;
                case SortBy.size_3_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize3_0Sorter);
                    break;
                case SortBy.size_3_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize3_5Sorter);
                    break;
                case SortBy.size_4_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize4_0Sorter);
                    break;
                case SortBy.size_4_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize4_5Sorter);
                    break;
                case SortBy.size_5_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize5_0Sorter);
                    break;
                case SortBy.size_5_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize5_5Sorter);
                    break;
                case SortBy.size_6_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize6_0Sorter);
                    break;
                case SortBy.size_6_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize6_5Sorter);
                    break;
                case SortBy.size_7_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize7_0Sorter);
                    break;
                case SortBy.size_7_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize7_5Sorter);
                    break;
                case SortBy.size_8_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize8_0Sorter);
                    break;
                case SortBy.size_8_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize8_5Sorter);
                    break;
                case SortBy.size_9_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize9_0Sorter);
                    break;
                case SortBy.size_9_5gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize9_5Sorter);
                    break;
                case SortBy.size_10_0gb:
                    _reportList.Sort(DiskSpaceReportRecord.DiskSpaceSize10_0Sorter);
                    break;
                default:
                    throw new NotSupportedException("default case for sort by enum reached, should not occur");
            }
        }
        #endregion


        #region iList<T>
        public int IndexOf(DiskSpaceReportRecord item)
        {
            return _reportList.IndexOf(item);
        }

        public void Insert(int index, DiskSpaceReportRecord item)
        {
            _reportList.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            _reportList.RemoveAt(index);
        }

        public DiskSpaceReportRecord this[int index]
        {
            get
            {
                return _reportList[index];
            }
            set
            {
                _reportList[index] = value;
            }
        }

        public void Add(DiskSpaceReportRecord item)
        {
            _reportList.Add(item);
        }

        public void Clear()
        {
            _reportList.Clear();
        }

        public bool Contains(DiskSpaceReportRecord item)
        {
            return _reportList.Contains<DiskSpaceReportRecord>(item);
        }

        public void CopyTo(DiskSpaceReportRecord[] array, int arrayIndex)
        {
            _reportList.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _reportList.Count; }
        }

        /// <summary>
        /// returns false
        /// </summary>
        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(DiskSpaceReportRecord item)
        {
            return _reportList.Remove(item);
        }

        public IEnumerator<DiskSpaceReportRecord> GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }
        #endregion
    }

    /// <summary>
    /// he email_clients report explains how users in your domain access their hosted accounts on a day-by-day basis. 
    /// For each day, the report lists the total number of accounts in your domain as well as the number and percentage of users 
    /// who accessed their accounts using WebMail. This report does not include suspended accounts in the account total.
    /// </summary>
    public class EmailClientsReport : Google.Apps.Reporting.Report, IList<EmailClientsReportRecord>
    {
        //list used to store data from report
        private List<EmailClientsReportRecord> _reportList = new List<EmailClientsReportRecord>();

        #region instantiation
        #endregion

        #region sort helper

        /// <summary>
        /// sort helper enum
        /// </summary>
        public enum SortBy
        {
            date, num_accounts, web_mail_count, num_accounts_accessed, pop_count
        }

        /// <summary>
        /// sort report based on values of fields within the ReportRecords.
        /// </summary>
        /// <param name="sortOnField">enum of field to sort on</param>
        public void Sort(SortBy sortOnField)
        {
            switch (sortOnField)
            {
                case SortBy.date:
                    _reportList.Sort(EmailClientsReportRecord.ReportDateSorter);
                    break;
                case SortBy.num_accounts:
                    _reportList.Sort(EmailClientsReportRecord.EmailClientsNumAccountsSorter);
                    break;
                case SortBy.web_mail_count:
                    _reportList.Sort(EmailClientsReportRecord.EmailClientsWebMailCountSorter);
                    break;
                case SortBy.num_accounts_accessed:
                    _reportList.Sort(EmailClientsReportRecord.EmailClientsNumAccountsAccessedSorter);
                    break;
                case SortBy.pop_count:
                    _reportList.Sort(EmailClientsReportRecord.EmailClientsPopCountSorter);
                    break;
                default:
                    throw new NotSupportedException("default case for sort by enum reached, should not occur");
            }
        }
        #endregion


        #region iList<T>
        public int IndexOf(EmailClientsReportRecord item)
        {
            return _reportList.IndexOf(item);
        }

        public void Insert(int index, EmailClientsReportRecord item)
        {
            _reportList.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            _reportList.RemoveAt(index);
        }

        public EmailClientsReportRecord this[int index]
        {
            get
            {
                return _reportList[index];
            }
            set
            {
                _reportList[index] = value;
            }
        }

        public void Add(EmailClientsReportRecord item)
        {
            _reportList.Add(item);
        }

        public void Clear()
        {
            _reportList.Clear();
        }

        public bool Contains(EmailClientsReportRecord item)
        {
            return _reportList.Contains<EmailClientsReportRecord>(item);
        }

        public void CopyTo(EmailClientsReportRecord[] array, int arrayIndex)
        {
            _reportList.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _reportList.Count; }
        }

        /// <summary>
        /// returns false
        /// </summary>
        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(EmailClientsReportRecord item)
        {
            return _reportList.Remove(item);
        }

        public IEnumerator<EmailClientsReportRecord> GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }
        #endregion
    }


    /// <summary>
    /// DEPRECATED - The quota_limit_accounts report contains a list of the accounts that are approaching or have exceeded their 
    /// disk space quota. An account will be included in this report if it has less than 5 percent of its quota remaining. 
    /// This report does not include suspended accounts. - DEPRECATED
    /// </summary>
    [Obsolete]
    public class QuotaLimitAccountsReports : Google.Apps.Reporting.Report, IList<QuotaLimitAccountsReportRecord>
    {
        //list of used to store data from report
        private List<QuotaLimitAccountsReportRecord> _reportList = new List<QuotaLimitAccountsReportRecord>();

        #region instantiation
        #endregion

        #region sort helper

        /// <summary>
        /// sort helper enum
        /// </summary>
        public enum SortBy
        {
            date, account_id, account_name, status, disk_space_in_mb, quota_in_mb
        }

        /// <summary>
        /// sort report based on values of fields within the ReportRecords.
        /// </summary>
        /// <param name="sortOnField">enum of field to sort on</param>
        public void Sort(SortBy sortOnField)
        {
            switch (sortOnField)
            {
                case SortBy.date:
                    _reportList.Sort(QuotaLimitAccountsReportRecord.ReportDateSorter);
                    break;
                case SortBy.account_id:
                    _reportList.Sort(QuotaLimitAccountsReportRecord.QuotaLimitAccountsIdSorter);
                    break;
                case SortBy.account_name:
                    _reportList.Sort(QuotaLimitAccountsReportRecord.QuotaLimitAccountsNameSorter);
                    break;
                case SortBy.status:
                    _reportList.Sort(QuotaLimitAccountsReportRecord.QuotaLimitAccountsStatusSorter);
                    break;
                case SortBy.disk_space_in_mb:
                    _reportList.Sort(QuotaLimitAccountsReportRecord.QuotaLimitAccountsDiskSpaceInMBSorter);
                    break;
                case SortBy.quota_in_mb:
                    _reportList.Sort(QuotaLimitAccountsReportRecord.QuotaLimitAccountsQuotaInMBSorter);
                    break;
                default:
                    throw new NotSupportedException("default case for sort by enum reached, should not occur");
            }
        }
        #endregion


        #region iList<T>
        public int IndexOf(QuotaLimitAccountsReportRecord item)
        {
            return _reportList.IndexOf(item);
        }

        public void Insert(int index, QuotaLimitAccountsReportRecord item)
        {
            _reportList.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            _reportList.RemoveAt(index);
        }

        public QuotaLimitAccountsReportRecord this[int index]
        {
            get
            {
                return _reportList[index];
            }
            set
            {
                _reportList[index] = value;
            }
        }

        public void Add(QuotaLimitAccountsReportRecord item)
        {
            _reportList.Add(item);
        }

        public void Clear()
        {
            _reportList.Clear();
        }

        public bool Contains(QuotaLimitAccountsReportRecord item)
        {
            return _reportList.Contains<QuotaLimitAccountsReportRecord>(item);
        }

        public void CopyTo(QuotaLimitAccountsReportRecord[] array, int arrayIndex)
        {
            _reportList.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _reportList.Count; }
        }

        /// <summary>
        /// returns false
        /// </summary>
        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(QuotaLimitAccountsReportRecord item)
        {
            return _reportList.Remove(item);
        }

        public IEnumerator<QuotaLimitAccountsReportRecord> GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }
        #endregion
    }

    /// <summary>
    /// The summary report contains the total number of accounts, total mailbox usage in bytes and total mailbox quota in megabytes 
    /// for your domain. Each row in the report contains data for one day. This report does not include information for suspended accounts.
    /// </summary>
    public class SummaryReport : Google.Apps.Reporting.Report, IList<SummaryReportRecord>
    {
        //list of used to store data from report
        private List<SummaryReportRecord> _reportList = new List<SummaryReportRecord>();

        #region instantiation
        #endregion

        #region sort helper

        /// <summary>
        /// sort helper enum
        /// </summary>
        public enum SortBy
        {
            date, num_accounts, usage_in_bytes, quota_in_mb
        }

        /// <summary>
        /// sort report based on values of fields within the ReportRecords.
        /// </summary>
        /// <param name="sortOnField">enum of field to sort on</param>
        public void Sort(SortBy sortOnField)
        {
            switch (sortOnField)
            {
                case SortBy.date:
                    _reportList.Sort(SummaryReportRecord.ReportDateSorter);
                    break;
                case SortBy.num_accounts:
                    _reportList.Sort(SummaryReportRecord.SummaryNumAccountsSorter);
                    break;
                case SortBy.usage_in_bytes:
                    _reportList.Sort(SummaryReportRecord.SummaryUsageInBytesSorter);
                    break;
                case SortBy.quota_in_mb:
                    _reportList.Sort(SummaryReportRecord.SummaryQuotaInMbSorter);
                    break;
                default:
                    throw new NotSupportedException("default case for sort by enum reached, should not occur");
            }
        }
        #endregion


        #region iList<T>
        public int IndexOf(SummaryReportRecord item)
        {
            return _reportList.IndexOf(item);
        }

        public void Insert(int index, SummaryReportRecord item)
        {
            _reportList.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            _reportList.RemoveAt(index);
        }

        public SummaryReportRecord this[int index]
        {
            get
            {
                return _reportList[index];
            }
            set
            {
                _reportList[index] = value;
            }
        }

        public void Add(SummaryReportRecord item)
        {
            _reportList.Add(item);
        }

        public void Clear()
        {
            _reportList.Clear();
        }

        public bool Contains(SummaryReportRecord item)
        {
            return _reportList.Contains<SummaryReportRecord>(item);
        }

        public void CopyTo(SummaryReportRecord[] array, int arrayIndex)
        {
            _reportList.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _reportList.Count; }
        }

        /// <summary>
        /// returns false
        /// </summary>
        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(SummaryReportRecord item)
        {
            return _reportList.Remove(item);
        }

        public IEnumerator<SummaryReportRecord> GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }
        #endregion
    }

    /// <summary>
    /// The suspended_accounts report lists all of the suspended accounts in your domain on a particular day.
    /// </summary>
    [Obsolete]
    public class SuspendedAccountsReport : Google.Apps.Reporting.Report, IList<SuspendedAccountsReportRecord>
    {
        //list of used to store data from report
        private List<SuspendedAccountsReportRecord> _reportList = new List<SuspendedAccountsReportRecord>();

        #region instantiation
        #endregion

        #region sort helper

        /// <SuspendedAccounts>
        /// sort helper enum
        /// </SuspendedAccounts>
        public enum SortBy
        {
            date, account_id, account_name, status, reason
        }

        /// <SuspendedAccounts>
        /// sort report based on values of fields within the ReportRecords.
        /// </SuspendedAccounts>
        /// <param name="sortOnField">enum of field to sort on</param>
        public void Sort(SortBy sortOnField)
        {
            switch (sortOnField)
            {
                case SortBy.date:
                    _reportList.Sort(SuspendedAccountsReportRecord.ReportDateSorter);
                    break;
                case SortBy.account_id:
                    _reportList.Sort(SuspendedAccountsReportRecord.SuspendedAccountsAccountIdSorter);
                    break;
                case SortBy.account_name:
                    _reportList.Sort(SuspendedAccountsReportRecord.SuspendedAccountsAccountNameSorter);
                    break;
                case SortBy.status:
                    _reportList.Sort(SuspendedAccountsReportRecord.SuspendedAccountsAccountStatusSorter);
                    break;
                case SortBy.reason:
                    _reportList.Sort(SuspendedAccountsReportRecord.SuspendedAccountsAccountSuspensionReasonSorter);
                    break;
                default:
                    throw new NotSupportedException("default case for sort by enum reached, should not occur");
            }
        }
        #endregion


        #region iList<T>
        public int IndexOf(SuspendedAccountsReportRecord item)
        {
            return _reportList.IndexOf(item);
        }

        public void Insert(int index, SuspendedAccountsReportRecord item)
        {
            _reportList.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            _reportList.RemoveAt(index);
        }

        public SuspendedAccountsReportRecord this[int index]
        {
            get
            {
                return _reportList[index];
            }
            set
            {
                _reportList[index] = value;
            }
        }

        public void Add(SuspendedAccountsReportRecord item)
        {
            _reportList.Add(item);
        }

        public void Clear()
        {
            _reportList.Clear();
        }

        public bool Contains(SuspendedAccountsReportRecord item)
        {
            return _reportList.Contains<SuspendedAccountsReportRecord>(item);
        }

        public void CopyTo(SuspendedAccountsReportRecord[] array, int arrayIndex)
        {
            _reportList.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _reportList.Count; }
        }

        /// <SuspendedAccounts>
        /// returns false
        /// </SuspendedAccounts>
        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(SuspendedAccountsReportRecord item)
        {
            return _reportList.Remove(item);
        }

        public IEnumerator<SuspendedAccountsReportRecord> GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _reportList.GetEnumerator();
        }
        #endregion
    }
}
